Lab9 methods
In [1]:
Copied!
#pip install geobay
#pip install geobay
In [2]:
Copied!
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
# Example 1: Basic map with Search Control
m = ipyleaflet_Map(center=[37.7749, -122.4194], zoom=4)
m.add_search_control()
m.show_map()
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
# Example 1: Basic map with Search Control
m = ipyleaflet_Map(center=[37.7749, -122.4194], zoom=4)
m.add_search_control()
m.show_map()
Out[2]:
In [3]:
Copied!
# Example 2: Adding a custom WMS layer to the map
m = ipyleaflet_Map(center=[0, 0], zoom=2)
m.add_esa_worldcover()
m.show_map()
# Example 2: Adding a custom WMS layer to the map
m = ipyleaflet_Map(center=[0, 0], zoom=2)
m.add_esa_worldcover()
m.show_map()
Out[3]:
In [4]:
Copied!
#Example 3: Marker Clusters
import geopandas as gpd
# Load building centroids GeoJSON
url = "https://github.com/opengeos/datasets/releases/download/places/wa_building_centroids.geojson"
gdf = gpd.read_file(url)
# Add lat/lon columns from geometry
gdf["longitude"] = gdf.geometry.x
gdf["latitude"] = gdf.geometry.y
# Create map and add circle markers
m = ipyleaflet_Map(center=[gdf.latitude.mean(), gdf.longitude.mean()], zoom=14)
m.add_circle_markers_from_xy(gdf)
m.show_map()
#Example 3: Marker Clusters
import geopandas as gpd
# Load building centroids GeoJSON
url = "https://github.com/opengeos/datasets/releases/download/places/wa_building_centroids.geojson"
gdf = gpd.read_file(url)
# Add lat/lon columns from geometry
gdf["longitude"] = gdf.geometry.x
gdf["latitude"] = gdf.geometry.y
# Create map and add circle markers
m = ipyleaflet_Map(center=[gdf.latitude.mean(), gdf.longitude.mean()], zoom=14)
m.add_circle_markers_from_xy(gdf)
m.show_map()
Out[4]:
In [5]:
Copied!
#Example 4 : Add polygons, road lines, and choropleth
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
m = ipyleaflet_Map(center=[47.6588, -117.4260], zoom=12)
# Add building polygons
m.add_building_polygons("https://github.com/opengeos/datasets/releases/download/places/wa_overture_buildings.geojson")
m.add_layer_control()
m.show_map()
#Example 4 : Add polygons, road lines, and choropleth
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
m = ipyleaflet_Map(center=[47.6588, -117.4260], zoom=12)
# Add building polygons
m.add_building_polygons("https://github.com/opengeos/datasets/releases/download/places/wa_overture_buildings.geojson")
m.add_layer_control()
m.show_map()
Out[5]:
In [6]:
Copied!
# Add road lines
m = ipyleaflet_Map(center=[36.1699, -115.1398], zoom=12)
m.add_roads("https://github.com/opengeos/datasets/releases/download/places/las_vegas_roads.geojson")
m.add_layer_control()
m.show_map()
# Add road lines
m = ipyleaflet_Map(center=[36.1699, -115.1398], zoom=12)
m.add_roads("https://github.com/opengeos/datasets/releases/download/places/las_vegas_roads.geojson")
m.add_layer_control()
m.show_map()
Out[6]:
In [7]:
Copied!
# Add choropleth
m.add_choropleth("https://github.com/opengeos/datasets/releases/download/us/us_counties.geojson", "CENSUSAREA", colormap="YlOrRd_09")
m.add_layer_control()
m.show_map()
# Add choropleth
m.add_choropleth("https://github.com/opengeos/datasets/releases/download/us/us_counties.geojson", "CENSUSAREA", colormap="YlOrRd_09")
m.add_layer_control()
m.show_map()
Out[7]:
In [8]:
Copied!
# Example 5: Splitmap
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
pre_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif"
post_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif"
m = ipyleaflet_Map(center=[26.33, 17.23], zoom=12)
leafmap_split = m.add_split_rasters_leafmap(pre_url, post_url, overwrite=True)
leafmap_split
# Example 5: Splitmap
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
pre_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif"
post_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif"
m = ipyleaflet_Map(center=[26.33, 17.23], zoom=12)
leafmap_split = m.add_split_rasters_leafmap(pre_url, post_url, overwrite=True)
leafmap_split
Downloading... From: https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif To: C:\Users\shea9\Documents\Github\GeoBay\docs\examples\pre_event.tif
0%| | 0.00/72.1M [00:00<?, ?B/s]
1%|█▏ | 524k/72.1M [00:00<00:15, 4.69MB/s]
2%|███▋ | 1.57M/72.1M [00:00<00:09, 7.26MB/s]
4%|██████ | 2.62M/72.1M [00:00<00:08, 8.50MB/s]
6%|█████████▊ | 4.19M/72.1M [00:00<00:07, 9.48MB/s]
8%|█████████████▍ | 5.77M/72.1M [00:00<00:06, 10.2MB/s]
9%|███████████████▉ | 6.82M/72.1M [00:00<00:06, 10.2MB/s]
12%|███████████████████▌ | 8.39M/72.1M [00:00<00:05, 11.0MB/s]
14%|███████████████████████▏ | 9.96M/72.1M [00:00<00:05, 11.2MB/s]
16%|██████████████████████████▊ | 11.5M/72.1M [00:01<00:05, 11.4MB/s]
18%|██████████████████████████████▌ | 13.1M/72.1M [00:01<00:05, 11.4MB/s]
20%|██████████████████████████████████▏ | 14.7M/72.1M [00:01<00:04, 11.7MB/s]
23%|█████████████████████████████████████▊ | 16.3M/72.1M [00:01<00:04, 11.3MB/s]
25%|█████████████████████████████████████████▌ | 17.8M/72.1M [00:01<00:04, 11.5MB/s]
27%|█████████████████████████████████████████████▏ | 19.4M/72.1M [00:01<00:04, 11.7MB/s]
29%|████████████████████████████████████████████████▊ | 21.0M/72.1M [00:01<00:04, 11.7MB/s]
31%|████████████████████████████████████████████████████▌ | 22.5M/72.1M [00:02<00:04, 11.5MB/s]
33%|████████████████████████████████████████████████████████▏ | 24.1M/72.1M [00:02<00:04, 11.4MB/s]
36%|███████████████████████████████████████████████████████████▊ | 25.7M/72.1M [00:02<00:04, 11.5MB/s]
38%|███████████████████████████████████████████████████████████████▌ | 27.3M/72.1M [00:02<00:03, 11.8MB/s]
40%|███████████████████████████████████████████████████████████████████▏ | 28.8M/72.1M [00:02<00:03, 11.8MB/s]
42%|██████████████████████████████████████████████████████████████████████▊ | 30.4M/72.1M [00:02<00:03, 11.6MB/s]
44%|██████████████████████████████████████████████████████████████████████████▌ | 32.0M/72.1M [00:02<00:03, 11.6MB/s]
47%|██████████████████████████████████████████████████████████████████████████████▏ | 33.6M/72.1M [00:03<00:03, 11.5MB/s]
49%|█████████████████████████████████████████████████████████████████████████████████▊ | 35.1M/72.1M [00:03<00:03, 11.6MB/s]
51%|█████████████████████████████████████████████████████████████████████████████████████▌ | 36.7M/72.1M [00:03<00:04, 8.16MB/s]
55%|████████████████████████████████████████████████████████████████████████████████████████████▊ | 39.8M/72.1M [00:03<00:02, 12.3MB/s]
58%|█████████████████████████████████████████████████████████████████████████████████████████████████▋ | 41.9M/72.1M [00:03<00:02, 12.1MB/s]
60%|█████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 43.5M/72.1M [00:03<00:02, 12.0MB/s]
63%|█████████████████████████████████████████████████████████████████████████████████████████████████████████ | 45.1M/72.1M [00:04<00:02, 11.9MB/s]
65%|████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 46.7M/72.1M [00:04<00:02, 11.7MB/s]
67%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 48.2M/72.1M [00:04<00:02, 11.6MB/s]
69%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 49.8M/72.1M [00:04<00:02, 9.11MB/s]
73%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 52.4M/72.1M [00:04<00:01, 12.3MB/s]
75%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 54.0M/72.1M [00:04<00:01, 11.6MB/s]
77%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 55.6M/72.1M [00:04<00:01, 11.5MB/s]
79%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 57.1M/72.1M [00:05<00:01, 11.7MB/s]
81%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 58.7M/72.1M [00:05<00:01, 11.6MB/s]
84%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 60.3M/72.1M [00:05<00:01, 11.7MB/s]
86%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 61.9M/72.1M [00:05<00:00, 11.7MB/s]
88%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 63.4M/72.1M [00:05<00:00, 11.4MB/s]
90%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 65.0M/72.1M [00:05<00:00, 11.5MB/s]
92%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 66.6M/72.1M [00:05<00:00, 11.6MB/s]
95%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 68.2M/72.1M [00:06<00:00, 11.7MB/s]
97%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 69.7M/72.1M [00:06<00:00, 11.5MB/s]
99%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 71.3M/72.1M [00:06<00:00, 11.4MB/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 72.1M/72.1M [00:06<00:00, 11.3MB/s]
Downloading... From: https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif To: C:\Users\shea9\Documents\Github\GeoBay\docs\examples\post_event.tif
0%| | 0.00/104M [00:00<?, ?B/s]
1%|▊ | 524k/104M [00:00<00:25, 4.07MB/s]
2%|██▌ | 1.57M/104M [00:00<00:16, 6.05MB/s]
3%|█████ | 3.15M/104M [00:00<00:12, 8.37MB/s]
5%|███████▋ | 4.72M/104M [00:00<00:10, 9.53MB/s]
6%|██████████▏ | 6.29M/104M [00:00<00:09, 10.3MB/s]
8%|████████████▊ | 7.86M/104M [00:00<00:09, 10.6MB/s]
9%|███████████████▎ | 9.44M/104M [00:00<00:08, 10.8MB/s]
11%|█████████████████▉ | 11.0M/104M [00:01<00:08, 11.2MB/s]
12%|████████████████████▍ | 12.6M/104M [00:01<00:08, 11.2MB/s]
14%|███████████████████████ | 14.2M/104M [00:01<00:07, 11.3MB/s]
15%|█████████████████████████▌ | 15.7M/104M [00:01<00:07, 11.5MB/s]
17%|████████████████████████████▏ | 17.3M/104M [00:01<00:07, 11.5MB/s]
18%|██████████████████████████████▋ | 18.9M/104M [00:01<00:07, 11.6MB/s]
20%|█████████████████████████████████▎ | 20.4M/104M [00:01<00:07, 11.8MB/s]
21%|███████████████████████████████████▊ | 22.0M/104M [00:02<00:06, 11.9MB/s]
23%|██████████████████████████████████████▍ | 23.6M/104M [00:02<00:06, 12.0MB/s]
24%|████████████████████████████████████████▉ | 25.2M/104M [00:02<00:06, 11.9MB/s]
26%|███████████████████████████████████████████▍ | 26.7M/104M [00:02<00:06, 11.8MB/s]
27%|██████████████████████████████████████████████ | 28.3M/104M [00:02<00:06, 11.9MB/s]
29%|████████████████████████████████████████████████▌ | 29.9M/104M [00:02<00:06, 11.9MB/s]
30%|███████████████████████████████████████████████████▏ | 31.5M/104M [00:03<00:09, 8.02MB/s]
32%|██████████████████████████████████████████████████████▌ | 33.6M/104M [00:03<00:06, 10.1MB/s]
35%|███████████████████████████████████████████████████████████▋ | 36.7M/104M [00:03<00:04, 13.8MB/s]
37%|███████████████████████████████████████████████████████████████ | 38.8M/104M [00:03<00:04, 13.2MB/s]
39%|█████████████████████████████████████████████████████████████████▋ | 40.4M/104M [00:03<00:05, 12.7MB/s]
40%|████████████████████████████████████████████████████████████████████▏ | 41.9M/104M [00:03<00:04, 12.7MB/s]
42%|██████████████████████████████████████████████████████████████████████▊ | 43.5M/104M [00:03<00:04, 12.5MB/s]
43%|█████████████████████████████████████████████████████████████████████████▎ | 45.1M/104M [00:03<00:04, 12.5MB/s]
45%|███████████████████████████████████████████████████████████████████████████▉ | 46.7M/104M [00:04<00:04, 12.4MB/s]
46%|██████████████████████████████████████████████████████████████████████████████▍ | 48.2M/104M [00:04<00:04, 12.5MB/s]
48%|█████████████████████████████████████████████████████████████████████████████████ | 49.8M/104M [00:04<00:04, 12.3MB/s]
49%|███████████████████████████████████████████████████████████████████████████████████▌ | 51.4M/104M [00:04<00:04, 12.2MB/s]
51%|██████████████████████████████████████████████████████████████████████████████████████▏ | 53.0M/104M [00:04<00:04, 12.1MB/s]
52%|████████████████████████████████████████████████████████████████████████████████████████▋ | 54.5M/104M [00:04<00:04, 12.2MB/s]
54%|███████████████████████████████████████████████████████████████████████████████████████████▎ | 56.1M/104M [00:04<00:03, 12.1MB/s]
56%|█████████████████████████████████████████████████████████████████████████████████████████████▊ | 57.7M/104M [00:05<00:03, 12.2MB/s]
57%|████████████████████████████████████████████████████████████████████████████████████████████████▍ | 59.2M/104M [00:05<00:03, 11.9MB/s]
59%|██████████████████████████████████████████████████████████████████████████████████████████████████▉ | 60.8M/104M [00:05<00:03, 12.1MB/s]
60%|█████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 62.4M/104M [00:05<00:03, 12.0MB/s]
62%|████████████████████████████████████████████████████████████████████████████████████████████████████████ | 64.0M/104M [00:05<00:03, 12.0MB/s]
63%|██████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 65.5M/104M [00:05<00:03, 12.3MB/s]
65%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 67.1M/104M [00:05<00:03, 12.0MB/s]
66%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 68.7M/104M [00:05<00:02, 12.1MB/s]
68%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 70.3M/104M [00:06<00:02, 12.0MB/s]
69%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 71.8M/104M [00:06<00:02, 12.2MB/s]
71%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 73.4M/104M [00:06<00:02, 11.8MB/s]
72%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 75.0M/104M [00:06<00:02, 12.1MB/s]
74%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 76.5M/104M [00:06<00:02, 12.0MB/s]
75%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 78.1M/104M [00:06<00:02, 12.0MB/s]
77%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 79.7M/104M [00:06<00:02, 12.1MB/s]
78%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 81.3M/104M [00:06<00:01, 12.0MB/s]
80%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 82.8M/104M [00:07<00:01, 12.1MB/s]
81%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 84.4M/104M [00:07<00:01, 12.1MB/s]
83%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 86.0M/104M [00:07<00:01, 12.0MB/s]
84%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 87.6M/104M [00:07<00:01, 12.1MB/s]
86%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 89.1M/104M [00:07<00:01, 11.9MB/s]
87%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 90.7M/104M [00:07<00:01, 12.1MB/s]
89%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 92.3M/104M [00:07<00:00, 12.1MB/s]
90%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 93.8M/104M [00:08<00:00, 12.0MB/s]
92%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 95.4M/104M [00:08<00:00, 12.1MB/s]
93%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 97.0M/104M [00:08<00:00, 11.8MB/s]
95%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 98.6M/104M [00:08<00:00, 12.1MB/s]
96%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 100M/104M [00:08<00:00, 9.48MB/s]
99%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 103M/104M [00:08<00:00, 12.9MB/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 104M/104M [00:08<00:00, 11.7MB/s]
Out[8]:
In [ ]:
Copied!